<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>复试组首页</title>
    <link rel="stylesheet" href="../static/plugins/bootstrap-5.3.0-alpha1-dist/css/bootstrap.min.css">
    <script src="../static/plugins/bootstrap-5.3.0-alpha1-dist/js/bootstrap.bundle.min.js"></script>
    <style>
        body {
            padding-top: 20px;
        }
        .navbar-brand img {
            height: auto;
        }
        .table th, .table td {
            vertical-align: middle;
        }
        .pagination {
            justify-content: center;
            display: flex;
        }
    </style>
</head>
<body>
{% if error_msg %}
    <div class="alert alert-danger" role="alert">
        {{ error_msg }}
    </div>
{% endif %}
<nav class="navbar bg-body-tertiary">
    <div class="container">
        <a class="navbar-brand" href="#">
            <img src="../static/img/bjfu.png" alt="Bootstrap" width="252" height="61">
        </a>
        <h3 style="color: green">北京林业大学复试组后台管理系统</h3>
        <nav class="navbar bg-body-tertiary">
            <div class="container-fluid">
                <form class="d-flex" role="search" method="post" action="{% url 'search_in_registration' %}">
                    {% csrf_token %}
                    <input class="form-control me-2" type="search" placeholder="Search" aria-label="Search" name="stu_name">
                    <button class="btn btn-outline-success" type="submit">Search</button>
                </form>
                <form method="post" action="{% url 'registration_info' %}">
                    {% csrf_token %}
                    <button class="btn btn-outline-success" type="submit">显示全部学生</button>
                </form>
                <li class="nav-item dropdown">
                    <a class="nav-link dropdown-toggle"  role="button" data-bs-toggle="dropdown" aria-expanded="false">
                      Hello!复试组管理员
                    </a>
                    <ul class="dropdown-menu">
                      <li><a class="dropdown-item" href="#">Action</a></li>
                      <li><a class="dropdown-item" href="#">Another action</a></li>
                      <li><hr class="dropdown-divider"></li>
                      <li><a class="dropdown-item" href="{% url 'index' %}">主页</a></li>
                    </ul>
                  </li>
            </div>
        </nav>
    </div>
</nav>
<div class="container mt-4">
    <table class="table table-bordered table-hover">
        <thead class="table-dark">
        <tr>
            <th scope="col">考生考号</th>
            <th scope="col">考生姓名</th>
            <th scope="col">考生数学分数</th>
            <th scope="col">考生英语分数</th>
            <th scope="col">考生政治分数</th>
            <th scope="col">考生综合分数</th>
            <th scope="col">选项</th>
        </tr>
        </thead>
        <tbody>
         {% for student in student_infos %}
            <tr>
            <th scope="row" name="stu_id">{{ student.examnumber }}</th>
            <td name="stu_name">{{ student.name }}</td>
            <td>{{ student.mathscore }}</td>
            <td>{{ student.englishscore }}</td>
            <td>{{ student.politicalscore }}</td>
            <td>{{ student.majorscore }}</td>
            <td>
                <form method="post" action="{% url 'start_registration' %}">
                    {% csrf_token %}
                    <input type="hidden" name="stu_id" value="{{ student.examnumber }}">
                    <button type="submit" class="btn btn-primary">开始复试</button>
                </form>
            </td>
        </tr>
         {% endfor %}
        </tbody>
    </table>
    <div class="pagination">
        <span class="step-links">
            {% if student_infos.has_previous %}
                <a href="?page=1">&laquo; 首页</a>
                <a href="?page={{ student_infos.previous_page_number }}">上一页</a>
            {% endif %}

            <span class="current">
                第 {{ student_infos.number }} 页，共 {{ student_infos.paginator.num_pages }} 页
            </span>

            {% if student_infos.has_next %}
                <a href="?page={{ student_infos.next_page_number }}">下一页</a>
                <a href="?page={{ student_infos.paginator.num_pages }}">末页 &raquo;</a>
            {% endif %}
        </span>
    </div>
</div>
</body>
</html>